<template>
	<!-- 爆款商品 -->
	<view class="">

		<view class="commodity">
			<view class="commodity-item" v-for="(item,index) in hotList" :key="index">
				<image class="commodity-img" :src="item.imgUrl" mode=""></image>
				<view class="commodity-content">
					<text class="commodity-name">{{item.name}}</text>
					<view class="commodity-price">
						<text class="pprice">￥{{item.pprice}}</text>
						<text class="oprice">￥{{item.oprice}}</text>
					</view>
					<text class="discount">{{item.discount}}折</text>
				</view>
			</view>
		</view>

	</view>

</template>

<script setup>
	import { ref } from 'vue'
	import mock from '../../mock/mock.js'
	let hotList = ref(mock.hotList)
</script>

<style scoped>
	.commodity {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding: 0 20rpx;
	}

	.commodity-item {
		width: 30%;
		padding-bottom: 20rpx;
	}

	.commodity-img {
		width: 100%;
		height: 275rpx;
		margin: 0 auto;
	}

	.commodity-content {
		text-align: center;
	}

	.commodity-name {
		text-align: left;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		color: #333333;
		word-break: break-all;
		padding: 6rpx 20rpx;
		font-size: 28rpx;
	}

	.commodity-price {
		margin-top: 10rpx;
	}

	.pprice {
		font-size: 32rpx;

	}

	.oprice {
		font-size: 24rpx;
		color: #999999;
		text-decoration: line-through;
	}

	.discount {
		border-radius: 4rpx;
		border: 1px solid #ff3333;
		font-size: 20rpx;
		padding: 2rpx 10rpx;
		color: #ff3333;

	}
</style>